# https://wtforms.readthedocs.io/en/2.3.x/

# https://blog.csdn.net/qq_41134008/article/details/105785048

from flask_wtf import FlaskForm
# FlaskWTFDeprecationWarning: "flask_wtf.Form" has been renamed to "FlaskForm" and will be removed in 1.0.
from wtforms import StringField, RadioField, DateField, DecimalField, SelectField, BooleanField, PasswordField, \
    SubmitField
# from wtforms import validators
from wtforms.validators import DataRequired, Email, Length, EqualTo
# from flask.ext.uploads import UploadSet, IMAGES
from flask_wtf.file import FileField, FileAllowed, FileRequired


class EmployeeForm(FlaskForm):
    name = StringField("姓名", [DataRequired('用户名必填！'), Length(min=4, max=20, message='用户名长度需4-20之间')])
    password = PasswordField(label="密码")
    # [validators.Email, validators.EqualTo('password')]
    gender = RadioField("性别", choices=[('男', '男'), ('女', '女')], default='男')
    birthdate = DateField('生日')
    salary = DecimalField('工资')
    department_id = SelectField('部门')
    isactivate = BooleanField('是否启用')

    upload = FileField('头像', [FileRequired(), FileAllowed(['jpg', 'png'], 'Images only!')])
    # recaptcha = RecaptchaField('验证码')  # 验证码 无显示原因  需要能连接到Google，使用的是Google验证器
    submit = SubmitField('提交')
